package com.slz3.business.module.systemManagement.sysRoleUser.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.systemManagement.sysRoleUser.domain.SysRoleUser;
import com.slz3.business.module.systemManagement.sysRoleUser.domain.SysRoleUserCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class SysRoleUserResController {

    @Resource
    private SysRoleUserResAtomic sysRoleUserResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, SysRoleUser sysRoleUser) {
        if (SysRoleUserResUnsafeValid.add(req, sysRoleUser)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.add_$SysRoleUserUpdateLock(req, sysRoleUser);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        if (SysRoleUserResUnsafeValid.delete(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.delete_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, SysRoleUser sysRoleUser) {
        if (SysRoleUserResUnsafeValid.modify(req, sysRoleUser)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.modify_$SysRoleUserUpdateLock(req, sysRoleUser);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (SysRoleUserResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return SysRoleUserResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return sysRoleUserResAtomic.info_$SysRoleUserUpdateLock(req);
        if (SysRoleUserResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.info_$SysRoleUserUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (SysRoleUserResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return SysRoleUserResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        //
        if (SysRoleUserResUnsafeValid.auditSubmit(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.auditSubmit_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        if (SysRoleUserResUnsafeValid.audit(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.audit_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        if (SysRoleUserResUnsafeValid.auditReject(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.auditReject_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        if (SysRoleUserResUnsafeValid.usingEnable(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.usingEnable_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, SysRoleUserCondition sysRoleUserCondition) {
        if (SysRoleUserResUnsafeValid.usingDisable(req, sysRoleUserCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return sysRoleUserResAtomic.usingDisable_$SysRoleUserUpdateLock(req, sysRoleUserCondition);
        }
    }

}
